<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="dom-attr-objects.html" />
<link rel="prev" href="dom-document-objects.html" />
<link rel="parent" href="node217.html" />
<link rel="next" href="dom-attr-objects.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>8.6.2.6 Element Objects </title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="8.6.2.5 document Objects"
  href="dom-document-objects.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="8.6.2 objects in the"
  href="node217.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="8.6.2.7 attr Objects"
  href="dom-attr-objects.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="dom-document-objects.html">8.6.2.5 Document Objects</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="node217.html">8.6.2 Objects in the</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="dom-attr-objects.html">8.6.2.7 Attr Objects</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h3><a name="SECTION0010626000000000000000"></a><a name="dom-element-objects"></a>
<br>
8.6.2.6 Element Objects 
</h3>

<p>
<tt class="class">Element</tt> is a subclass of <tt class="class">Node</tt>, so inherits all the
attributes of that class.

<p>
<dl><dt><b><tt id='l2h-1815' xml:id='l2h-1815' class="member">tagName</tt></b></dt>
<dd>
The element type name.  In a namespace-using document it may have
colons in it.  The value is a string.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1816' xml:id='l2h-1816' class="method">getElementsByTagName</tt></b>(</nobr></td>
  <td><var>tagName</var>)</td></tr></table></dt>
<dd>
Same as equivalent method in the <tt class="class">Document</tt> class.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1817' xml:id='l2h-1817' class="method">getElementsByTagNameNS</tt></b>(</nobr></td>
  <td><var>tagName</var>)</td></tr></table></dt>
<dd>
Same as equivalent method in the <tt class="class">Document</tt> class.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1818' xml:id='l2h-1818' class="method">hasAttribute</tt></b>(</nobr></td>
  <td><var>name</var>)</td></tr></table></dt>
<dd>
Returns true if the element has an attribute named by <var>name</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1819' xml:id='l2h-1819' class="method">hasAttributeNS</tt></b>(</nobr></td>
  <td><var>namespaceURI, localName</var>)</td></tr></table></dt>
<dd>
Returns true if the element has an attribute named by
<var>namespaceURI</var> and <var>localName</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1820' xml:id='l2h-1820' class="method">getAttribute</tt></b>(</nobr></td>
  <td><var>name</var>)</td></tr></table></dt>
<dd>
Return the value of the attribute named by <var>name</var> as a
string. If no such attribute exists, an empty string is returned,
as if the attribute had no value.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1821' xml:id='l2h-1821' class="method">getAttributeNode</tt></b>(</nobr></td>
  <td><var>attrname</var>)</td></tr></table></dt>
<dd>
Return the <tt class="class">Attr</tt> node for the attribute named by
<var>attrname</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1822' xml:id='l2h-1822' class="method">getAttributeNS</tt></b>(</nobr></td>
  <td><var>namespaceURI, localName</var>)</td></tr></table></dt>
<dd>
Return the value of the attribute named by <var>namespaceURI</var> and
<var>localName</var> as a string. If no such attribute exists, an empty
string is returned, as if the attribute had no value.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1823' xml:id='l2h-1823' class="method">getAttributeNodeNS</tt></b>(</nobr></td>
  <td><var>namespaceURI, localName</var>)</td></tr></table></dt>
<dd>
Return an attribute value as a node, given a <var>namespaceURI</var> and
<var>localName</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1824' xml:id='l2h-1824' class="method">removeAttribute</tt></b>(</nobr></td>
  <td><var>name</var>)</td></tr></table></dt>
<dd>
Remove an attribute by name.  No exception is raised if there is no
matching attribute.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1825' xml:id='l2h-1825' class="method">removeAttributeNode</tt></b>(</nobr></td>
  <td><var>oldAttr</var>)</td></tr></table></dt>
<dd>
Remove and return <var>oldAttr</var> from the attribute list, if present.
If <var>oldAttr</var> is not present, <tt class="exception">NotFoundErr</tt> is raised.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1826' xml:id='l2h-1826' class="method">removeAttributeNS</tt></b>(</nobr></td>
  <td><var>namespaceURI, localName</var>)</td></tr></table></dt>
<dd>
Remove an attribute by name.  Note that it uses a localName, not a
qname.  No exception is raised if there is no matching attribute.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1827' xml:id='l2h-1827' class="method">setAttribute</tt></b>(</nobr></td>
  <td><var>name, value</var>)</td></tr></table></dt>
<dd>
Set an attribute value from a string.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1828' xml:id='l2h-1828' class="method">setAttributeNode</tt></b>(</nobr></td>
  <td><var>newAttr</var>)</td></tr></table></dt>
<dd>
Add a new attribute node to the element, replacing an existing
attribute if necessary if the <tt class="member">name</tt> attribute matches.  If a
replacement occurs, the old attribute node will be returned.  If
<var>newAttr</var> is already in use, <tt class="exception">InuseAttributeErr</tt> will be
raised.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1829' xml:id='l2h-1829' class="method">setAttributeNodeNS</tt></b>(</nobr></td>
  <td><var>newAttr</var>)</td></tr></table></dt>
<dd>
Add a new attribute node to the element, replacing an existing
attribute if necessary if the <tt class="member">namespaceURI</tt> and
<tt class="member">localName</tt> attributes match.  If a replacement occurs, the old
attribute node will be returned.  If <var>newAttr</var> is already in use,
<tt class="exception">InuseAttributeErr</tt> will be raised.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1830' xml:id='l2h-1830' class="method">setAttributeNS</tt></b>(</nobr></td>
  <td><var>namespaceURI, qname, value</var>)</td></tr></table></dt>
<dd>
Set an attribute value from a string, given a <var>namespaceURI</var> and a
<var>qname</var>.  Note that a qname is the whole attribute name.  This is
different than above.
</dl>

<p>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="8.6.2.5 document Objects"
  href="dom-document-objects.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="8.6.2 objects in the"
  href="node217.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="8.6.2.7 attr Objects"
  href="dom-attr-objects.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="dom-document-objects.html">8.6.2.5 Document Objects</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="node217.html">8.6.2 Objects in the</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="dom-attr-objects.html">8.6.2.7 Attr Objects</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
